{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "c8d01073-09a8-4c68-b93b-aef463738bd0",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-06-03T01:18:57.068522Z",
     "iopub.status.busy": "2023-06-03T01:18:57.068295Z",
     "iopub.status.idle": "2023-06-03T01:18:58.924558Z",
     "shell.execute_reply": "2023-06-03T01:18:58.923658Z",
     "shell.execute_reply.started": "2023-06-03T01:18:57.068455Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "%pylab is deprecated, use %matplotlib inline and import the required libraries.\n",
      "Populating the interactive namespace from numpy and matplotlib\n"
     ]
    }
   ],
   "source": [
    "import os, sys, glob, argparse\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "from tqdm import tqdm\n",
    "\n",
    "%pylab inline\n",
    "\n",
    "import cv2\n",
    "from PIL import Image\n",
    "from sklearn.model_selection import train_test_split, StratifiedKFold, KFold\n",
    "\n",
    "import torch\n",
    "torch.manual_seed(0)\n",
    "torch.backends.cudnn.deterministic = False\n",
    "torch.backends.cudnn.benchmark = True\n",
    "\n",
    "import torchvision.models as models\n",
    "import torchvision.transforms as transforms\n",
    "import torchvision.datasets as datasets\n",
    "import torch.nn as nn\n",
    "import torch.nn.functional as F\n",
    "import torch.optim as optim\n",
    "from torch.autograd import Variable\n",
    "from torch.utils.data.dataset import Dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "70d2263d-916c-431e-aca7-3e5bcd867f9b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-06-03T01:18:58.925961Z",
     "iopub.status.busy": "2023-06-03T01:18:58.925827Z",
     "iopub.status.idle": "2023-06-03T01:18:58.951406Z",
     "shell.execute_reply": "2023-06-03T01:18:58.950419Z",
     "shell.execute_reply.started": "2023-06-03T01:18:58.925945Z"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "import nibabel as nib\n",
    "from nibabel.viewers import OrthoSlicer3D\n",
    "\n",
    "train_path = glob.glob('./脑PET图像分析和疾病预测挑战赛公开数据/Train/*/*')\n",
    "test_path = glob.glob('./脑PET图像分析和疾病预测挑战赛公开数据/Test/*')\n",
    "\n",
    "np.random.shuffle(train_path)\n",
    "np.random.shuffle(test_path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "938e88a7-6a1d-4aad-b28b-865b86f77b4c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-06-03T01:18:58.952447Z",
     "iopub.status.busy": "2023-06-03T01:18:58.952216Z",
     "iopub.status.idle": "2023-06-03T01:18:59.191132Z",
     "shell.execute_reply": "2023-06-03T01:18:59.190545Z",
     "shell.execute_reply.started": "2023-06-03T01:18:58.952430Z"
    },
    "scrolled": true,
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/19.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/21.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/4.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/8.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/2.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/10.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/11.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/13.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/6.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/18.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/2.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/22.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/6.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/23.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/13.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/14.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/17.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/1.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/16.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/12.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/15.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/4.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/5.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/20.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/17.nii (168, 168, 81)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/7.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/3.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/18.nii (256, 256, 81)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/14.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/25.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/8.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/16.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/9.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/15.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/11.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/24.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/22.nii (256, 256, 207)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/12.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/20.nii (168, 168, 81)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/1.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/3.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/23.nii (256, 256, 207)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/24.nii (256, 256, 207)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/9.nii (128, 128, 63)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/7.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/25.nii (400, 400, 109)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/19.nii (168, 168, 82)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/21.nii (128, 128, 540)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/NC/5.nii (128, 128, 47)\n",
      "./脑PET图像分析和疾病预测挑战赛公开数据/Train/MCI/10.nii (128, 128, 63)\n"
     ]
    }
   ],
   "source": [
    "for path in train_path:\n",
    "    img = nib.load(path)\n",
    "    print(path, img.dataobj[:, :, :, 0].shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "584f2188-cf45-4d72-abee-4dae0d362926",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-06-03T01:18:59.192013Z",
     "iopub.status.busy": "2023-06-03T01:18:59.191881Z",
     "iopub.status.idle": "2023-06-03T01:18:59.198447Z",
     "shell.execute_reply": "2023-06-03T01:18:59.197975Z",
     "shell.execute_reply.started": "2023-06-03T01:18:59.191997Z"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "DATA_CACHE = {}\n",
    "class XunFeiDataset(Dataset):\n",
    "    def __init__(self, img_path, transform=None):\n",
    "        self.img_path = img_path\n",
    "        if transform is not None:\n",
    "            self.transform = transform\n",
    "        else:\n",
    "            self.transform = None\n",
    "    \n",
    "    def __getitem__(self, index):\n",
    "        if self.img_path[index] in DATA_CACHE:\n",
    "            img = DATA_CACHE[self.img_path[index]]\n",
    "        else:\n",
    "            img = nib.load(self.img_path[index]) \n",
    "            img = img.dataobj[:,:,:, 0]\n",
    "            DATA_CACHE[self.img_path[index]] = img\n",
    "            \n",
    "        idx = np.random.choice(range(img.shape[-1]), 50)\n",
    "        # idx.sort()\n",
    "        img = img[:, :, idx]\n",
    "        img = img.astype(np.float32)\n",
    "        \n",
    "        # img /= 255.0\n",
    "        # img -= 1\n",
    "        \n",
    "        # print(img.shape)\n",
    "        if self.transform is not None:\n",
    "            img = self.transform(image = img)['image']\n",
    "        \n",
    "        img = img.transpose([2,0,1])\n",
    "        return img,torch.from_numpy(np.array(int('NC' in self.img_path[index])))\n",
    "    \n",
    "    def __len__(self):\n",
    "        return len(self.img_path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "bd5a22b6-3a32-4039-bcc7-a6c6f5f9cbaf",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-06-03T01:18:59.199252Z",
     "iopub.status.busy": "2023-06-03T01:18:59.199045Z",
     "iopub.status.idle": "2023-06-03T01:18:59.279712Z",
     "shell.execute_reply": "2023-06-03T01:18:59.278523Z",
     "shell.execute_reply.started": "2023-06-03T01:18:59.199237Z"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "class XunFeiNet(nn.Module):\n",
    "    def __init__(self):\n",
    "        super(XunFeiNet, self).__init__()\n",
    "                \n",
    "        model = models.resnet18(True)\n",
    "        model.conv1 = torch.nn.Conv2d(50, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)\n",
    "        model.avgpool = nn.AdaptiveAvgPool2d(1)\n",
    "        model.fc = nn.Linear(512, 2)\n",
    "        self.resnet = model\n",
    "        \n",
    "    def forward(self, img):        \n",
    "        out = self.resnet(img)\n",
    "        return out"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "47539bef-14a7-4881-85e9-0882ff295e6a",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-06-03T01:18:59.281839Z",
     "iopub.status.busy": "2023-06-03T01:18:59.281360Z",
     "iopub.status.idle": "2023-06-03T01:18:59.545763Z",
     "shell.execute_reply": "2023-06-03T01:18:59.545172Z",
     "shell.execute_reply.started": "2023-06-03T01:18:59.281792Z"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "def train(train_loader, model, criterion, optimizer):\n",
    "    model.train()\n",
    "    train_loss = 0.0\n",
    "    for i, (input, target) in enumerate(train_loader):\n",
    "        input = input.cuda(non_blocking=True)\n",
    "        target = target.cuda(non_blocking=True)\n",
    "\n",
    "        # compute output\n",
    "        output = model(input)\n",
    "        loss = criterion(output, target)\n",
    "\n",
    "        # compute gradient and do SGD step\n",
    "        optimizer.zero_grad()\n",
    "        loss.backward()\n",
    "        optimizer.step()\n",
    "\n",
    "        if i % 20 == 0:\n",
    "            print(loss.item())\n",
    "            \n",
    "        train_loss += loss.item()\n",
    "    \n",
    "    return train_loss/len(train_loader)\n",
    "            \n",
    "def validate(val_loader, model, criterion):\n",
    "    model.eval()\n",
    "    \n",
    "    val_acc = 0.0\n",
    "    \n",
    "    with torch.no_grad():\n",
    "        end = time.time()\n",
    "        for i, (input, target) in enumerate(val_loader):\n",
    "            input = input.cuda()\n",
    "            target = target.cuda()\n",
    "\n",
    "            # compute output\n",
    "            output = model(input)\n",
    "            loss = criterion(output, target)\n",
    "            \n",
    "            val_acc += (output.argmax(1) == target).sum().item()\n",
    "            \n",
    "    return val_acc / len(val_loader.dataset)\n",
    "\n",
    "def predict(test_loader, model, criterion):\n",
    "    model.eval()\n",
    "    val_acc = 0.0\n",
    "    \n",
    "    test_pred = []\n",
    "    with torch.no_grad():\n",
    "        end = time.time()\n",
    "        for i, (input, target) in enumerate(test_loader):\n",
    "            input = input.cuda()\n",
    "            target = target.cuda()\n",
    "\n",
    "            # compute output\n",
    "            output = model(input)\n",
    "            test_pred.append(output.data.cpu().numpy())\n",
    "            \n",
    "    return np.vstack(test_pred)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "c14b410f-de94-4f52-be5b-1377c34bda4a",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-06-03T01:18:59.548002Z",
     "iopub.status.busy": "2023-06-03T01:18:59.547705Z",
     "iopub.status.idle": "2023-06-03T01:18:59.753642Z",
     "shell.execute_reply": "2023-06-03T01:18:59.753117Z",
     "shell.execute_reply.started": "2023-06-03T01:18:59.547976Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/lyz/.local/lib/python3.9/site-packages/albumentations/augmentations/transforms.py:1639: FutureWarning: RandomContrast has been deprecated. Please use RandomBrightnessContrast\n",
      "  warnings.warn(\n"
     ]
    }
   ],
   "source": [
    "import albumentations as A\n",
    "\n",
    "train_loader = torch.utils.data.DataLoader(\n",
    "    XunFeiDataset(train_path[:-10],\n",
    "            A.Compose([\n",
    "            A.RandomRotate90(),\n",
    "            A.RandomCrop(120, 120),\n",
    "            A.HorizontalFlip(p=0.5),\n",
    "            A.RandomContrast(p=0.5),\n",
    "            A.RandomBrightnessContrast(p=0.5),\n",
    "        ])\n",
    "    ), batch_size=2, shuffle=True, num_workers=1, pin_memory=False\n",
    ")\n",
    "\n",
    "val_loader = torch.utils.data.DataLoader(\n",
    "    XunFeiDataset(train_path[-10:],\n",
    "            A.Compose([\n",
    "            A.RandomCrop(120, 120),\n",
    "            # A.HorizontalFlip(p=0.5),\n",
    "            # A.RandomContrast(p=0.5),\n",
    "        ])\n",
    "    ), batch_size=2, shuffle=False, num_workers=1, pin_memory=False\n",
    ")\n",
    "\n",
    "test_loader = torch.utils.data.DataLoader(\n",
    "    XunFeiDataset(test_path,\n",
    "            A.Compose([\n",
    "            A.RandomCrop(128, 128),\n",
    "            A.HorizontalFlip(p=0.5),\n",
    "            A.RandomContrast(p=0.5),\n",
    "        ])\n",
    "    ), batch_size=2, shuffle=False, num_workers=1, pin_memory=False\n",
    ")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "7f7ee8cb-cfc0-4eb8-96ea-7302144ae7a4",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-06-03T01:18:59.754831Z",
     "iopub.status.busy": "2023-06-03T01:18:59.754546Z",
     "iopub.status.idle": "2023-06-03T01:19:01.146156Z",
     "shell.execute_reply": "2023-06-03T01:19:01.145619Z",
     "shell.execute_reply.started": "2023-06-03T01:18:59.754805Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/lyz/.local/lib/python3.9/site-packages/torchvision/models/_utils.py:135: UserWarning: Using 'weights' as positional parameter(s) is deprecated since 0.13 and will be removed in 0.15. Please use keyword parameter(s) instead.\n",
      "  warnings.warn(\n",
      "/home/lyz/.local/lib/python3.9/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and will be removed in 0.15. The current behavior is equivalent to passing `weights=ResNet18_Weights.IMAGENET1K_V1`. You can also use `weights=ResNet18_Weights.DEFAULT` to get the most up-to-date weights.\n",
      "  warnings.warn(msg)\n"
     ]
    }
   ],
   "source": [
    "model = XunFeiNet()\n",
    "model = model.to('cuda')\n",
    "criterion = nn.CrossEntropyLoss().cuda()\n",
    "optimizer = torch.optim.AdamW(model.parameters(), 0.001)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "b2faad78-e794-4f31-8b56-1a64dbf89ccc",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-06-03T01:19:01.147372Z",
     "iopub.status.busy": "2023-06-03T01:19:01.147076Z",
     "iopub.status.idle": "2023-06-03T01:19:03.431144Z",
     "shell.execute_reply": "2023-06-03T01:19:03.430646Z",
     "shell.execute_reply.started": "2023-06-03T01:19:01.147347Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.6160869598388672\n",
      "1.3067537385970354 0.55 0.1\n"
     ]
    }
   ],
   "source": [
    "for _  in range(1):\n",
    "    train_loss = train(train_loader, model, criterion, optimizer)\n",
    "    val_acc  = validate(val_loader, model, criterion)\n",
    "    train_acc = validate(train_loader, model, criterion)\n",
    "    \n",
    "    print(train_loss, train_acc, val_acc)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "6787d12a-b923-4777-abf5-4d90904551d1",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-06-03T01:19:03.432282Z",
     "iopub.status.busy": "2023-06-03T01:19:03.432045Z",
     "iopub.status.idle": "2023-06-03T01:19:16.686713Z",
     "shell.execute_reply": "2023-06-03T01:19:16.685486Z",
     "shell.execute_reply.started": "2023-06-03T01:19:03.432264Z"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "pred = None\n",
    "\n",
    "for _ in range(10):\n",
    "    if pred is None:\n",
    "        pred = predict(test_loader, model, criterion)\n",
    "    else:\n",
    "        pred += predict(test_loader, model, criterion)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "1743990f-d27d-43cd-85fd-23a0ff0f2c36",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-06-03T01:19:16.687929Z",
     "iopub.status.busy": "2023-06-03T01:19:16.687699Z",
     "iopub.status.idle": "2023-06-03T01:19:16.692088Z",
     "shell.execute_reply": "2023-06-03T01:19:16.691662Z",
     "shell.execute_reply.started": "2023-06-03T01:19:16.687911Z"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "submit = pd.DataFrame(\n",
    "    {\n",
    "        'uuid': [int(x.split('/')[-1][:-4]) for x in test_path],\n",
    "        'label': pred.argmax(1)\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "cc565971-7a5f-4bb0-8ab5-c33281bc469c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-06-03T01:19:16.692845Z",
     "iopub.status.busy": "2023-06-03T01:19:16.692655Z",
     "iopub.status.idle": "2023-06-03T01:19:16.767855Z",
     "shell.execute_reply": "2023-06-03T01:19:16.767034Z",
     "shell.execute_reply.started": "2023-06-03T01:19:16.692830Z"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "submit['label'] = submit['label'].map({1:'NC', 0: 'MCI'})\n",
    "submit = submit.sort_values(by='uuid')\n",
    "submit.to_csv('submit2.csv', index=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "de0cae92-7686-4cea-93a9-83ba4356531e",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2023-06-03T01:19:16.768941Z",
     "iopub.status.busy": "2023-06-03T01:19:16.768723Z",
     "iopub.status.idle": "2023-06-03T01:19:16.872510Z",
     "shell.execute_reply": "2023-06-03T01:19:16.872057Z",
     "shell.execute_reply.started": "2023-06-03T01:19:16.768924Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>uuid</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>1</td>\n",
       "      <td>MCI</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>81</th>\n",
       "      <td>2</td>\n",
       "      <td>NC</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>3</td>\n",
       "      <td>MCI</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4</td>\n",
       "      <td>NC</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>5</td>\n",
       "      <td>NC</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59</th>\n",
       "      <td>96</td>\n",
       "      <td>NC</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>97</td>\n",
       "      <td>NC</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>66</th>\n",
       "      <td>98</td>\n",
       "      <td>NC</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>99</td>\n",
       "      <td>NC</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>100</td>\n",
       "      <td>NC</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    uuid label\n",
       "25     1   MCI\n",
       "81     2    NC\n",
       "45     3   MCI\n",
       "2      4    NC\n",
       "52     5    NC\n",
       "..   ...   ...\n",
       "59    96    NC\n",
       "97    97    NC\n",
       "66    98    NC\n",
       "10    99    NC\n",
       "23   100    NC\n",
       "\n",
       "[100 rows x 2 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "submit"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3fc9e8ed-2c50-4f92-ad5b-d53083b20895",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3.10"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.10"
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "state": {},
    "version_major": 2,
    "version_minor": 0
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
